<style>
	.dashed_border {
	  border-top: 1px dashed #ccc;
	  margin-bottom: 10px;
	  margin-left: -13px;
	  margin-top: 10px;
	}

  </style>

<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['系统基础管理','公司管理','项目对接配置']" icon="fa fa-list"
			class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span>
					<h2>项目对接配置</h2>
				</header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<div class="top_module">
									<span class="module_text">公司名称</span>
									<sa-company-tree companyTreeId="companyTree" (companySelected)="companySelected($event)">
									</sa-company-tree>
								</div>
								<div class="top_module">
									<span class="module_text">角色名称</span>
									<sa-select2 select2ElementID="roleSelect2" (optionSelected)="optionSelected($event)"
										[dataList]="roleList" [queryParam]="queryParam" [paramFormat]="paramFormat" matchSearch="true">
									</sa-select2>
								</div>
								<!--<div class="selectDate top_module">
									<table-select-date [notInit]='true' (outerTime)="getSelectTableTime($event)" ></table-select-date>
								</div>-->
								<button class="btn btn-primary" (click)="table_search()">查询</button>
								<button class="btn btn-primary" (click)="table_add(projectConfigModal)">新增</button>
							</div>
							<!--<div class="right top-search">
								<input type="text" [(ngModel)]="tableSearch.searchKey" (change)="table_search()" class="search-input" placeholder="接口名称">
								<span class="top-search-box">
									<button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
								</span>
							</div>-->
						</div>
						<div class="table_scroll">
							<table
								class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>项目名称</th>
										<th>对接角色</th>
										<th>启用项目车辆对接</th>
										<th>API接口启用到期限制</th>
										<th>是否开始第三方接口续费操作</th>
										<th>是否开放续费记录/对接记录</th>
										<th>描述</th>
										<th>更新人员</th>
										<th>更新时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData">
										<td>{{row.companyName}}</td>
										<td>{{row.roleName}}</td>
										<td>
											<span *ngIf="row.isOpenDocking == 1" class="green">启用</span>
											<span *ngIf="row.isOpenDocking == 0" class="orange">不启用</span>
										</td>
										<td>
											<span *ngIf="row.isOpenApi == 1" class="green">启用</span>
											<span *ngIf="row.isOpenApi == 0" class="orange">不启用</span>
										</td>
										<td>
											<span *ngIf="row.isOpenRenewalApi == 1" class="green">启用</span>
											<span *ngIf="row.isOpenRenewalApi == 0 || row.isOpenRenewalApi == null" class="orange">不启用</span>
										</td>
										<td>
											<span *ngIf="row.renewalRecodeQueryRoleState == 0 || row.renewalRecodeQueryRoleState == null" class="orange">不开放</span>
											<span *ngIf="row.renewalRecodeQueryRoleState == 1" class="green">开放续费</span>
											<span *ngIf="row.renewalRecodeQueryRoleState == 2" class="green">开放续费+对接</span>
										</td>
										<td>{{row.describe}}</td>
										<td>{{row.updateUser}}</td>
										<td>{{row.updateDate}}</td>
										<td>
											<button type="button" (click)="editRow(row,projectConfigModal)">编辑</button>
											<button type="button" (click)="delRow(row)">刪除</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount" [rows]="pageSize" [currentPage]="curPage - 1"
								(onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i
									class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
	<!--    弹窗-->
	<section bsModal #projectConfigModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
		aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="modalClose(projectConfigModal)" aria-label="Close"><span
							aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">项目对接配置 - <span *ngIf="formType == 'new'">新增</span><span
							*ngIf="formType == 'updata'">编辑</span></h4>
				</div>
				<form id="projectConfigFrom" class="form-horizontal" role="form" novalidate="novalidate"
					[saBootstrapValidator]="validatorOptions">
					<div class="modal-body">
						<div class="row form-horizontal">
							<div class="form-group col-xs-12 s_fix_select2">
								<label class="control-label col-xs-2" for="newPassword">项目名称<sup>*</sup></label>
								<div class="col-xs-10">
									<sa-company-tree companyTreeId="companyTreeForm" [Height]="32"
										[companyNameValue]="projectConfigFrom.companyName" [companyIdValue]="projectConfigFrom.companyId"
										(companySelected)="companySelectedForm($event)"></sa-company-tree>
								</div>
							</div>
							<div class="form-group col-xs-12 s_fix_select2">
								<label class="control-label col-xs-2" for="newPassword">角色名称<sup>*</sup></label>
								<div class="col-xs-10 s_fix_select2_width s_fix_select2">
									<!--<input type="text" class="form-control" name="roleName"  [(ngModel)]='projectConfigFrom.roleName'/>-->
									<sa-select2 select2ElementID="roleSelect2Form" (optionSelected)="optionSelectedForm($event)"
										[dataList]="roleList" [queryParam]="queryParam" [paramFormat]="paramFormat" matchSearch="true">
									</sa-select2>
								</div>
							</div>

							<div class="dashed_border col-xs-12"></div>

							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">启用项目车辆对接<sup>*</sup></label>
								<div class="col-xs-10">
									<label class="radio radio-inline" style="margin-right: 40px;">
										<input type="radio" class="radiobox" checked [(ngModel)]='projectConfigFrom.isOpenDocking'
											(change)="isOpenDockingChange($event.target.value)" value='1' name="modal1">
										<span>启用</span>
									</label>
									<label class="radio radio-inline" style="margin-right: 40px;">
										<input type="radio" class="radiobox" [(ngModel)]='projectConfigFrom.isOpenDocking'
											(change)="isOpenDockingChange($event.target.value)" value='0' name="modal2">
										<span>不启用</span>
									</label>
								</div>
							</div>

							<div class="dashed_border col-xs-12"></div>

							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">API接口启用到期限制<sup>*</sup></label>
								<div class="col-xs-10">
									<label class="radio radio-inline" style="margin-right: 40px;">
										<input type="radio" class="radiobox" checked [(ngModel)]='projectConfigFrom.isOpenApi'
											(change)="isOpenApiChange($event.target.value)" value='1' name="modal3">
										<span>启用</span>
									</label>
									<label class="radio radio-inline" style="margin-right: 40px;">
										<input type="radio" class="radiobox" [(ngModel)]='projectConfigFrom.isOpenApi'
											(change)="isOpenApiChange($event.target.value)" value='0' name="modal4">
										<span>不启用</span>
									</label>
								</div>
							</div>

							<div class="dashed_border col-xs-12"></div>

							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">是否开放续费记录/对接记录<sup>*</sup></label>
								<div class="col-xs-10">
									<label class="radio radio-inline" style="margin-right: 40px;">
										<input type="radio" class="radiobox" checked [(ngModel)]='projectConfigFrom.renewalRecodeQueryRoleState'
											(change)="isOpenRenewalRecordChange($event.target.value)" value='0' name="modal7">
										<span>不开放</span>
									</label>
									<label class="radio radio-inline" style="margin-right: 40px;">
										<input type="radio" class="radiobox" [(ngModel)]='projectConfigFrom.renewalRecodeQueryRoleState'
											(change)="isOpenRenewalRecordChange($event.target.value)" value='1' name="modal8">
										<span>开放续费</span>
									</label>
									<label class="radio radio-inline" style="margin-right: 40px;">
										<input type="radio" class="radiobox" [(ngModel)]='projectConfigFrom.renewalRecodeQueryRoleState'
											(change)="isOpenRenewalRecordChange($event.target.value)" value='2' name="modal9">
										<span>开放续费+对接</span>
									</label>
								</div>
							</div>

							<div class="dashed_border col-xs-12"></div>

							<div class="form-group col-xs-12 ">
								<label class="col-xs-2 control-label">是否开始第三方接口续费操作<sup>*</sup></label>
								<div class="col-xs-10">
									<label class="radio radio-inline" style="margin-right: 40px;">
										<input type="radio" class="radiobox" checked [(ngModel)]='projectConfigFrom.isOpenRenewalApi'
											(change)="isOpenRenewalApiChange($event.target.value)" value='1' name="modal5">
										<span>启用</span>
									</label>
									<label class="radio radio-inline" style="margin-right: 40px;">
										<input type="radio" class="radiobox" [(ngModel)]='projectConfigFrom.isOpenRenewalApi'
											(change)="isOpenRenewalApiChange($event.target.value)" value='0' name="modal6">
										<span>不启用</span>
									</label>
								</div>
							</div>
							<div class="form-group col-xs-12" *ngIf="projectConfigFrom.isOpenRenewalApi == 1">
								<label class="col-xs-2 control-label">到期天数</label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" type="text" [(ngModel)]='projectConfigFrom.maxExpirationDay' name='maxExpirationDay' maxlength="9"  (change)="changeMaxExpirationDay($event.target.value)"/>
								</div>
							</div>

							<div class="dashed_border col-xs-12"></div>
							
							<div class="form-group col-xs-12" *ngIf="projectConfigFrom.isOpenApi == 1">
								<label class="col-xs-2 control-label">延迟天数<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" type="number" [(ngModel)]='projectConfigFrom.putOffForDay' name='putOffForDay' />
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">描述</label>
								<div class="col-xs-10">
									<input class="form-control" type="text" [(ngModel)]='projectConfigFrom.describe' name='describe' />
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" (click)="modalClose(projectConfigModal)">取消</button>
						<button type="button" class="btn btn-primary" (click)="apiControlSubmit(projectConfigModal)">确认</button>
					</div>
				</form>
			</div>
		</div>
	</section>
	<!--  弹窗end-->
</div>